import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '部门',
    align:"center",
    dataIndex: 'orgCode_dictText'
   },
   {
    title: '席位名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '席位IP',
    align:"center",
    dataIndex: 'ip'
   },
   {
    title: '监控设备',
    align:"center",
    dataIndex: 'equipmentId_dictText'
   },
   {
    title: '是否禁用',
    align:"center",
    dataIndex: 'disable_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
    label: '部门',
    field: 'orgCode',
    component: 'JDictSelectTag',
    componentProps: () => {
      return {
        dictCode: 'sys_depart,depart_name,org_code,org_code like "A01A%"',
      }
    },
  },
  {
    label: '席位名称',
    field: 'name',
    component: 'JInput',
  },
  {
    label: '是否禁用',
    field: 'disable',
    component: 'JDictSelectTag',
    componentProps: () => {
      return {
        dictCode: 'yn',
      }
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'orgCode',
    component: 'JDictSelectTag',
    componentProps: () => {
      return {
        dictCode: 'sys_depart,depart_name,org_code,org_code like "A01A%"',
      }
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择部门'},
          ];
     },
  },
  {
    label: '席位名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入席位名称!'},
          ];
     },
  },
  {
    label: '席位IP',
    field: 'ip',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入席位IP!'},
          ];
     },
  },
  {
    label: '监控设备',
    field: 'equipmentId',
    component: 'JDictSelectTag',
    componentProps: () => {
      return {
        dictCode: 'gbiac_equipment,name,id,category = "monitor"',
      }
    },
    dynamicRules: ({model,schema}) => {
        return [
               { required: true, message: '请选择监控设备!'},
        ];
   },
  },
  {
    label: '是否禁用',
    field: 'disable',
    component: 'JDictSelectTag',
    componentProps: () => {
      return {
        dictCode: 'yn',
        type: 'radio'
      }
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择是否禁用!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  tenantId: {title: '租户号',order: 0,view: 'text', type: 'string',},
  orgCode: {title: '部门编码',order: 2,view: 'text', type: 'string',},
  name: {title: '席位名称',order: 3,view: 'text', type: 'string',},
  ip: {title: '席位ip',order: 4,view: 'text', type: 'string',},
  equipmentId: {title: '监控设备id',order: 5,view: 'text', type: 'string',},
  disable: {title: '是否禁用;0/否；1/是；',order: 6,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
